package com.edu.exam.enums.examination;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 会话事件类型枚举
 */
@Getter
@AllArgsConstructor
public enum SessionEventType {
    LOGIN("LOGIN", "登录"),
    LOGOUT("LOGOUT", "登出"),
    START("START", "开始"),
    END("END", "结束"),
    PAUSE("PAUSE", "暂停"),
    RESUME("RESUME", "恢复"),
    TIMEOUT("TIMEOUT", "超时"),
    ERROR("ERROR", "错误"),
    WARNING("WARNING", "警告"),
    INFO("INFO", "信息"),
    SECURITY("SECURITY", "安全事件"),
    SYSTEM("SYSTEM", "系统事件"),
    USER("USER", "用户事件"),
    DATA("DATA", "数据事件");

    private final String code;
    private final String description;

    public static SessionEventType fromCode(String code) {
        for (SessionEventType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return INFO; // 默认返回信息
    }
}